package rabbitas {
	/**
	 * @author martindyrby
	 */
	public class PropertyResolver {
		public static const PROP:String="prop";
		private static const EVENT:String="event";
		
		static public function isProperty(value:XML):Boolean {
			return value.name() == PROP || value.name() == EVENT;
		}
		
		static public function resolveValue(value:XML, instanceManager:InstanceManager):* {
			var propname:String = value.@name;
			var propvalue:String = value.@value;
			var propchild:XMLList = value.children();
			
			if (propvalue != '') {
				return Reflector.reflectStringValue(propvalue, instanceManager);
			} else if (propchild.length() > 0) {
				return instanceManager.getObjectById(propchild[0].@id);
			}
			
			return null;
		}
	}
}
